package com.hyacinth.lotterysystem.controller;

import com.hyacinth.lotterysystem.common.pojo.CommonResult;
import com.hyacinth.lotterysystem.service.EmailService;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotNull;
import org.apache.commons.mail.EmailException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/email")
public class EmailController {
    @Resource
    private EmailService emailService;

    @GetMapping("/verification-code")
    public CommonResult<Boolean> sendEmailVerificationCode(@NotNull String email) throws EmailException {
        emailService.sendEmailVerificationCode(email);
        return CommonResult.success(true);
    }
}
